cmake_minimum_required(VERSION 3.4.1)

add_library( djvulibrejni

             SHARED

             src/main/cpp/jni.cpp )

include_directories( src/main/cpp )

add_definitions( -DHAVE_CONFIG_H )

# one day we will be able to replace those lines with find_library(djvulibre-lib djvulibre)
add_library(djvulibre SHARED IMPORTED)
string(REPLACE "/android-djvulibre/intermediates/" "/libdjvu/intermediates/" DJVU_TARGET "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libdjvu.so")
include_directories(libdjvu/src/main/cpp)
set_target_properties(djvulibre PROPERTIES IMPORTED_LOCATION ${DJVU_TARGET})

find_library( log-lib log )
find_library( android-lib android )
find_library( jnigraphics-lib jnigraphics )

target_link_libraries( djvulibrejni ${log-lib} ${android-lib} ${jnigraphics-lib} djvulibre )
